(gdb) b main
Breakpoint 1 at 0x40055d: file gdb-sample.c, line 14.
(gdb) r
Starting program: /home/linzw/Documents/cstuty/gdb/gdb-sample 

Breakpoint 1, main () at gdb-sample.c:14
14	    n = 1;
(gdb) s
15	    n++;
(gdb) p n
$1 = 1
(gdb) b 21
Breakpoint 2 at 0x40058a: file gdb-sample.c, line 21.
(gdb) b tempFunction
Breakpoint 3 at 0x400534: file gdb-sample.c, line 7.
(gdb) c
Continuing.

Breakpoint 2, main () at gdb-sample.c:21
21	    printf("n = %d, nGlobalVar = %d /n", n, nGlobalVar);
(gdb) p nGlobalVar
$2 = 88
(gdb) c
Continuing.

Breakpoint 3, tempFunction (a=1, b=2) at gdb-sample.c:7
7	    printf("tempFunction is called, a = %d, b = %d /n", a, b);
(gdb) p a
$3 = 1
(gdb) p b
$4 = 2
(gdb) c
Continuing.
n = 1, nGlobalVar = 88 /ntempFunction is called, a = 1, b = 2 /nn = 3[Inferior 1 (process 5761) exited normally]



(gdb) display /i $pc
1: x/i $pc
<error: No registers.>
(gdb) r
Starting program: /home/linzw/Documents/cstuty/gdb/gdb-sample 

Breakpoint 1, main () at gdb-sample.c:14
14	    n = 1;
1: x/i $pc
=> 0x40055d <main+8>:	movl   $0x1,-0x4(%rbp)
(gdb) si
15	    n++;
1: x/i $pc
=> 0x400564 <main+15>:	addl   $0x1,-0x4(%rbp)
(gdb) si
16	    n--;
1: x/i $pc
=> 0x400568 <main+19>:	subl   $0x1,-0x4(%rbp)
(gdb)

(gdb) d
Delete all breakpoints? (y or n) y
(gdb) b *main
Breakpoint 4 at 0x400555: file gdb-sample.c, line 12.
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/linzw/Documents/cstuty/gdb/gdb-sample 

Breakpoint 4, main () at gdb-sample.c:12
12	{
1: x/i $pc
=> 0x400555 <main>:	push   %rbp
(gdb) si
0x0000000000400556	12	{
1: x/i $pc
=> 0x400556 <main+1>:	mov    %rsp,%rbp
(gdb) si
0x0000000000400559	12	{
1: x/i $pc
=> 0x400559 <main+4>:	sub    $0x10,%rsp
(gdb) si
14	    n = 1;
1: x/i $pc
=> 0x40055d <main+8>:	movl   $0x1,-0x4(%rbp)
(gdb) si
15	    n++;
1: x/i $pc
=> 0x400564 <main+15>:	addl   $0x1,-0x4(%rbp)
(gdb) i r
rax            0x400555	4195669
rbx            0x0	0
rcx            0x0	0
rdx            0x7fffffffe4b8	140737488348344
rsi            0x7fffffffe4a8	140737488348328
rdi            0x1	1
rbp            0x7fffffffe3c0	0x7fffffffe3c0
rsp            0x7fffffffe3b0	0x7fffffffe3b0
r8             0x400650	4195920
r9             0x7ffff7de78e0	140737351940320
r10            0x846	2118
r11            0x7ffff7a2e740	140737348036416
r12            0x400430	4195376
r13            0x7fffffffe4a0	140737488348320
r14            0x0	0
r15            0x0	0
rip            0x400564	0x400564 <main+15>
eflags         0x202	[ IF ]
cs             0x33	51
ss             0x2b	43
ds             0x0	0
es             0x0	0
fs             0x0	0
gs             0x0	0
(gdb) i r rsp
rsp            0x7fffffffe3b0	0x7fffffffe3b0
(gdb)  q
